<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>问卷详情</title>
    <link rel="stylesheet" href="/static/css/bootstrap.min.css">
    <link rel="stylesheet" href="/static/css/surveypage.css">
</head>

<body>
    <div class="container">
        <div class="survey_card">        
        <div class="page">
            <div class="theme_state_label">
                <div class="theme_lable">
                    <label>{{surveys.surveyTheme}}</label>
                </div>
                <div class="border"></div>
                <div class="state_lable">
                    <label>{{surveys.surveyState}}</label>
                </div>
            </div>
            {% for item in questions %}
            <div class="card">
                <div class="pageIndex">
                    <div class="pageIndex-lable">
                        <label>{{item.questionNumber}}.{{item.questionContent}} </label>
                    </div>
                    <input type="text" placeholder="1~10分，10分为最高分" id="score_{{item.questionNumber}}">
                </div>
            </div>
            {% endfor %}
            <div class="btn-css">
                <label style="display: none;">{{surveystate.state}}</label>
                <input class=" btn btn-outline-primary" type="button" value="发布" onclick="send()" id="btn_send">
                <input class=" btn btn-outline-primary" type="button" value="发布" id="btn_disabled" disabled >
            </div>
        </div>
</div>
    </div>

    <script src="/static/js/jquery-3.6.0.min.js"></script>
    <script src="https://cdn.bootcss.com/axios/0.18.0/axios.min.js"></script>
    <script>
        let label = $('.btn-css label').text();
        if(label === "1"){
            let n = $('#btn_send').css('display','none');
            console.log(n);
        }else{
            $('#btn_disabled').css('display','none');
        }
    </script>
    <script>
        function send() {
            axios({
                method: 'post',
                url: '/survey/send'
            }).then(function (response) {
                // axios工具下，服务器真正返回的数据在返回对象的data中
                let res = response.data;
                if (res.code === 200) {
                    window.location.href = "/surveyAll"
                } else {
                    // console.log("cuole");
                }
            }).catch((err) => {

            });
        } 
        
    </script>
</body>

</html>